import { NextApiRequest, NextApiResponse } from "next";
import prisma from "../../../../lib/prisma";

export default async function handle(
  req: NextApiRequest,
  res: NextApiResponse
) {
  const userId = req.query.id as string;

  const result = await prisma.user.delete({
    where: {
      id: parseInt(userId),
    },
  });

  return res.json({
    code: 200,
    data: result,
  });
}
